# generated with cmake/gen_cmake_skeleton.py, DO NOT MODIFY.
set(PUBLIC_HEADERS
    chain-datastruct.h
    chain-den-graph.h
    chain-denominator.h
    chain-generic-numerator.h
    chain-kernels-ansi.h
    chain-numerator.h
    chain-supervision.h
    chain-training.h
    language-model.h
)

if(CUDA_FOUND)
    cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
    cuda_compile(CUDA_OBJS SHARED
        chain-kernels.cu
    )
endif()

add_library(kaldi-chain
    chain-den-graph.cc
    chain-denominator.cc
    chain-generic-numerator.cc
    chain-numerator.cc
    chain-supervision.cc
    chain-training.cc
    language-model.cc
    ${CUDA_OBJS}
)

target_include_directories(kaldi-chain PUBLIC 
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
     $<INSTALL_INTERFACE:include/kaldi>
)

target_link_libraries(kaldi-chain PUBLIC
    kaldi-cudamatrix
    kaldi-lat
    kaldi-fstext
    kaldi-hmm
    kaldi-tree
    kaldi-util
    kaldi-matrix
    kaldi-base
    -lcblas
    -llapack
)

if(KALDI_BUILD_TEST)
    add_kaldi_test_executable(NAME chain-supervision-test SOURCES chain-supervision-test.cc DEPENDS kaldi-chain)
    add_kaldi_test_executable(NAME language-model-test SOURCES language-model-test.cc DEPENDS kaldi-chain)
endif()

install(TARGETS kaldi-chain
    EXPORT kaldi-targets
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT kaldi
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT kaldi
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT kaldi
)
install(FILES ${PUBLIC_HEADERS} DESTINATION include/kaldi/chain COMPONENT kaldi)

